package com.sysmanage.etl.model;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "ETL_TABLE")
public class ETL_Table implements Serializable {
	private static final long serialVersionUID = 3401510117787500052L;
	private Integer table_id;
	private String table_name;
	private String table_alais;
	private Boolean display = false;
	private Boolean table_exists = true;

	private ETL_DataSource dataSource;
	private Set<ETL_Property> propertys;

	public ETL_Table() {
	}

	public ETL_Table(String table_name, ETL_DataSource dataSource) {
		this.table_name = table_name;
		this.dataSource = dataSource;
	}

	@Id
	@GeneratedValue
	@Column(name = "TABLE_ID")
	public Integer getTable_id() {
		return table_id;
	}

	public void setTable_id(Integer table_id) {
		this.table_id = table_id;
	}

	@Column(name = "TABLE_NAME")
	public String getTable_name() {
		return table_name;
	}

	public void setTable_name(String table_name) {
		this.table_name = table_name;
	}

	@ManyToOne
	@JoinColumn(name = "DATASOURCE_ID")
	public ETL_DataSource getDataSource() {
		return dataSource;
	}

	public void setDataSource(ETL_DataSource dataSource) {
		this.dataSource = dataSource;
	}

	@OneToMany(mappedBy = "table", fetch = FetchType.LAZY)
	public Set<ETL_Property> getPropertys() {
		return propertys;
	}

	public void setPropertys(Set<ETL_Property> propertys) {
		this.propertys = propertys;
	}

	@Column(name = "TABLE_ALAIS")
	public String getTable_alais() {
		return table_alais;
	}

	public void setTable_alais(String table_alais) {
		this.table_alais = table_alais;
	}

	@Column(name = "DISPLAY")
	public Boolean getDisplay() {
		return display;
	}

	public void setDisplay(Boolean display) {
		this.display = display;
	}

	@Column(name = "TABLE_EXISTS")
	public Boolean getTable_exists() {
		return table_exists;
	}

	public void setTable_exists(Boolean table_exists) {
		this.table_exists = table_exists;
	}

}
